import React, { Component } from 'react'
import { connect } from 'react-redux'
import * as actions from './store/action/person.action'
import {bindActionCreators} from 'redux'

class App extends Component {

  handle = () => {
    console.log("获取数据")
    this.props.getListAction()
  }

  render() {
    console.log(this.props)
    return (
      <div className="App">
        <button onClick={this.handle}>获取数据</button>
      </div>
    );
  }
}

const mapStateToProps = ( state ) => {
  console.log(state)
  return {
    person: state.personReducer.person
  }
}

const mapActionToProps = (dispatch) => {
  return {
    ...bindActionCreators(actions, dispatch)
  }
}

export default connect(mapStateToProps, mapActionToProps)(App);
